Supporting Host Header Names in Older Browsers

Microsoft Internet Explorer 3.0, Netscape Navigator 2.0, and later versions of both browsers support the use of host header names; earlier versions of the two browsers do not. If you are using host header names to host multiple sites on the same IP address and port, you can implement the following procedures to provide a way for visitors with older browsers to reach the correct site.

Caution   Using the Registry Editor incorrectly can cause problems, including the failure of a Web site or FTP site. If you make mistakes, your Web site or FTP site's configuration could be damaged. You should edit registry entries only for settings that you cannot adjust in the user interface, and use caution whenever you edit the registry directly.

To configure the registry
  1. To open the registry for editing, type Regedt32.exe in a command window and press ENTER.
  2. Enable or add the following values in the following location
  3. HKEY_LOCAL_MACHINE\SYSTEM
     \CurrentControlSet
      \Services
       \W3SVC
        \Parameters

    DLCSupport   Set the value of this parameter to 1 to enable support for browsers that are capable of passing cookies.

    DLCMenuString   This parameter supplies the special prefix of URLs that apply to the host menu. This is a special string that the server checks all downlevel requests (that is, requests without a real host header) against. If the URL is prefixed by this string, then it is handled as a host menu item. For example, DLCMenuString can be set to "/HostMenu." Note the initial forward slash in the string.

    DLCMungeMenuDocumentString   This parameter is the name of the host menu document that will be sent to browsers that do not support cookies. For example, this parameter could be set to "/Scripts/Munge.asp."

    DLCHostNameString   This parameter supplies the host name of the Web site that contains the index documents. For example, if your menu page resides on www.server1.com, this parameter is set to "www.server1.com." Note that all files, such as images and backgrounds, must be located on the same Web site.

    DLCCookieMenuDocumentString   This parameter is the name of the actual host menu document to be sent to older browsers that support cookies. For example, this parameter could be "/Scripts/Cookies.asp."

    DLCCookieNameString   This parameter specifies the name of the special cookie to be interpreted by the server as representing a pseudo host header. For example, this parameter could be "PseudoHost."

  4. When you have finished, you must restart your computer.

 

To redirect the browser
  1. Place the following scripts in the Mysite/Scripts directory, where Mysite is the Web site identified in the DCLHostNameString registry setting.
  2. Copy the following script into a text editor and save the file as Munge.asp. Replace the example site names, www.example1.microsoft.com and www.example2.microsoft.com, with the actual names of your sites.
  3. <HTML>
    <HEAD><TITLE>Server Selection Page</TITLE></HEAD>
    
    <BODY>
    
    <A HREF="http://www.example1.microsoft.com/*www.example1.microsoft.com/<%=Request.QueryString()%>">Try www.example1.microsoft.com</A><BR>
    <A HREF="http://www.example2.microsoft.com/*www.example2.microsoft.com/<%=Request.QueryString()%>">Try www.example2.microsoft.com</A><BR>
    
    </BODY>
    </HTML>
  4. Copy the following script into a text editor and save the file as Cookie.asp.
  5. <HTML>
    <HEAD><TITLE>Server Selection Page</TITLE></HEAD>
    
    <BODY>
    
    <A HREF="/HostMenu/Scripts/Redirect.asp?Host=www.example1.microsoft.com & NewLocation = <% = request.querystring()%>">Try www.example1.microsoft.com</A><BR>
    <A HREF="/HostMenu/Scripts/Redirect.asp?Host=www.example2.microsoft.com & NewLocation = <% = request.querystring()%>">Try www.example2.microsoft.com</A><BR>
    
    </BODY>
    </HTML>
  6. Copy the following script into a text editor and save the file as Redirect.asp.
  7. <%
    
      Option Explicit
    
      Dim DLCCookieNameString
    
      DLCCookieNameString = "PseudoHost"
    
      Response.Cookies(DLCCookieNameString) = Request.QueryString("Host")
      Response.Cookies(DLCCookieNameString).Domain = Request.QueryString("Host")
      Response.Cookies(DLCCookieNameString).Path = "/"
    
      Response.Redirect "http://" & Request.Querystring("Host") & Request.QueryString("NewLocation")
    
    %>			

Related Topics


© 1997-1999 Microsoft Corporation. All rights reserved.